package ve.ejb.entity;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Enumerated;
import javax.persistence.OneToMany;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author memozac
 */
@Entity
public class Project extends ScoreCard implements Serializable {
    private static final long serialVersionUID = 1L;

    public enum Status{UNINITIALIZED,DELAYED,ON_TIME,TERMINATED};

    @OneToMany private Collection<Milestone> milestones;

    @Enumerated private Status status;

    @Column(columnDefinition="text") private String observations;

    @Temporal(value = TemporalType.TIMESTAMP) private Date registerDate;

    public Date getRegisterDate() {
        return registerDate;
    }

    public void setRegisterDate(Date registerDate) {
        this.registerDate = registerDate;
    }

    public Status getStatus() {
        return status;
    }

    public void setStatus(Status status) {
        this.status = status;
    }

    public String getObservations() {
        return observations;
    }

    public void setObservations(String observations) {
        this.observations = observations;
    }

    public Collection<Milestone> getMilestones() {
        return milestones;
    }

    public void setMilestones(Collection<Milestone> milestones) {
        this.milestones = milestones;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idScoreCard != null ? idScoreCard.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        if (!(object instanceof Project)) {
            return false;
        }
        Project other = (Project) object;
        if ((this.idScoreCard == null && other.idScoreCard != null) || (this.idScoreCard != null && !this.idScoreCard.equals(other.idScoreCard))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ve.ejb.entity.Project[id=" + idScoreCard + "]";
    }

}//ends of class
